 -- curl -i --data 'info=wasabi.com Yes~' '127.0.0.1:6699/api/decode_info'
local json 			= require "cjson"

ngx.req.read_body()

local args 			= ngx.req.get_post_args()

if not args or not args.info then
	ngx.exit(ngx.HTTP_BAD_REQUEST)
end

local client_ip 	= ngx.var.remote_addr
local user_agent 	= ngx.req.get_headers()['user-agent'] or ''
local info 			=  args.info 

local rep 			= {}
rep.info 			= info
rep.info_encode 	= ngx.encode_base64(info)
rep.ip       		= client_ip
rep.user_agent		= user_agent

 
ngx.say(json.encode(rep))